use strict;
use warnings;
use lib '/home/yasumoto/.cpanm/work/1312182090.2395/Path-Class-0.24/lib/';
use Plack::Request;
#use Plack::Response;
use Path::Class qw/dir file/;
use FindBin;
use Imager;
my $dir = $FindBin::Bin;

my $ppp = sub {
    my $env = shift;
#   my @sorted_key = sort keys %$env;
    my $req = Plack::Request->new($env);
    my $path_info = $req->path_info;

    my $file = file($dir, 'data', $path_info);

    my $body = "Not Found $file $path_info \n";
    if ( -f $file ) {
	#kokokara,gazouhennkannsite,sorewo data/120x120/nihozonn
#	my $img = Imager->new;
#	$img->read(file => '$file')
#		or die $img->errstr;
#
#	$img = $img->scale(
#			xpixels => 120,
#			ypixels => 120,
#
#);

#$img->write(file => 'data/120x120/sliceimg.jpg')
#		or die $img->errstr;
        $body = "Found $file $path_info \n \$dir is $dir \n\n ";
        $body .= $file->slurp; 
    }

    my $res = $req->new_response(200);
    $res->content_type('text/plain');
    $res->body($body);
    return $res->finalize;
 
};
__END__
----
$ cd /home/user/labs/
$ plackup app.psgi

----
http://127.0.0.1:5000/hoge.txt

----
"/home/user/labs/data/hoge.txt"があれはそのな中身を返す

Found /home/user/labs/data/hoge.txt. /hoge.txt. 
